﻿Public Class mailforward

    Private Sub mailforward_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        checkForwarder.Checked = My.Settings.mailforward
        txtTitle.Text = My.Settings.mailtitle
        checkHeader.Checked = My.Settings.mailenableheader
        txtHeader.Text = My.Settings.mailheader
        txtmaillistloc.Text = My.Settings.maillistloc


        If System.IO.File.Exists(My.Settings.maillistloc) = True Then
            Dim objReader As New System.IO.StreamReader(My.Settings.maillistloc)
            Do While objReader.Peek() <> -1
                Dim spliter As String()
                spliter = objReader.ReadLine().Split("|")
                With ListView1.Items.Add(spliter(0))
                    .SubItems.AddRange(New String() {spliter(1)})
                End With
            Loop
        End If

    End Sub

    Private Sub checkHeader_CheckedChanged(sender As Object, e As EventArgs) Handles checkHeader.CheckedChanged
        If checkHeader.Checked Then
            txtHeader.Enabled = True
        Else
            txtHeader.Enabled = False
        End If
    End Sub

  
    Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
        Dim openfiled As New OpenFileDialog
        openfiled.Filter = "Text File|*.txt"
        openfiled.Title = "Select a Mailing list"
        If openfiled.ShowDialog() = DialogResult.OK Then
            If System.IO.File.Exists(openfiled.FileName) = True Then
                Dim objReader As New System.IO.StreamReader(openfiled.FileName)
                Do While objReader.Peek() <> -1
                    Dim spliter As String()
                    spliter = objReader.ReadLine().Split("|")
                    With ListView1.Items.Add(spliter(0))
                        .SubItems.AddRange(New String() {spliter(1)})
                    End With
                Loop
                My.Settings.maillistloc = openfiled.FileName
                My.Settings.Save()
                txtmaillistloc.Text = My.Settings.maillistloc
            End If
        End If
    End Sub

    Private Sub GroupBox1_Enter(sender As Object, e As EventArgs) Handles GroupBox1.Enter

    End Sub
End Class
